// 使用 import type 专门导入类型
import type { MockMethod } from 'vite-plugin-mock'
import menuList from '../data/menuInfo.json'
interface MenuRequestBody {
  token: string
}
// 明确指定类型为MockMethod数组
const mock: MockMethod[] = [
  {
    url: '/api/menu',
    method: 'post',
    response: ({ body }: { body: MenuRequestBody }) => {
      const { token } = body
      if(token === '123') {
        return {
          code: 200,
          message: '获取成功',
          data: {
            menuList
          }
        }
      }
      return {
        code: 401,
        message: '未知异常',
      }
    }
  }
]

export default mock
    